﻿<%@ Control Language="C#" AutoEventWireup="true" Inherits="HL.Lib.MVC.ViewControl" %>
<% 
    var item = ViewBag.Data as ModNewsEntity;
    var Title = (!string.IsNullOrEmpty(ViewBag.Title)) ? ViewBag.Title as string : ViewPage.CurrentPage.Name;
    List<ModImageEntity> listImage = ModImageService.Instance.CreateQuery()
        .Where(o => o.NewsID == item.ID)
        .ToList();
    string listimg = string.Empty;
    for (int i = 0; listImage != null && i < listImage.Count; i++)
    {
        if (!string.IsNullOrEmpty(listImage[i].File))
        {
            listimg += (string.IsNullOrEmpty(listimg) ? string.Empty : ",") + "'" + listImage[i].File.Replace("~/", "/") + "'";
        }
    }
    if (!string.IsNullOrEmpty(listimg))
    {
        listimg = "[" + listimg + "]";
    }

    var entity = ViewBag.Contact as ModFeedbackEntity;
    if (entity == null) entity = new ModFeedbackEntity();

    int typeshow = HL.Core.Global.Convert.ToInt(ViewBag.TypeShow, 1);
    if (typeshow == 0) typeshow = 1;
%>
<p class="m_title">
    <%=item.Name %></p>
<%if (listImage != null)
  {
      int count = listImage.Count;
%>
<div class="product">
    <%if ((item.State & 1) == 1)
      { %>
    <div class="pnews">
    </div>
    <%} %>
    <script type="text/javascript">
    api_gallery=<%=listimg %>;
    </script>
    <a href="javascript:;" onclick="$.prettyPhoto.open(api_gallery,'<%=item.Name %>',''); return false">
        <img class="product_big" id="Img" src="<%=listImage[0].File.Replace("~/","/") %>"
            alt="sanpham" /></a>
    <div class="product_small">
        <a class="arr_top" href="javascript:;" onclick="slide_back();" title="top"></a><a
            class="arr_bottom" title="down" href="javascript:;" onclick="slide_next();">
        </a>
        <div class="product_list" id="show">
        </div>
    </div>
    <p class="clear">
    </p>
</div>
<script type="text/javascript">
    var index = 0;
    var newsid = <%=item.ID %>;
    var maxindex = Math.ceil(<%= listImage ==  null ? 0 : listImage.Count %> / 3);
    slide_change();
    function showIMG(src)
    {
    var obj = document.getElementById('Img');
    obj.setAttribute('src',src);
    }
</script>
<%}%>
<p class="m_title">
    Giới thiệu</p>
<div class="content">
    <%if (!string.IsNullOrEmpty(item.Menu))
      { %>
        <script type="text/javascript">
    api_gallery1=[<%=item.Menu %>];
    </script>
    <%} %>
    <%if (!string.IsNullOrEmpty(item.Service))
      { %>
            <script type="text/javascript">
    api_gallery2=[<%=item.Service %>];
    </script>
    <%} %>
    <%
        if (typeshow == 1)
        {
    %>
    <a <%if (!string.IsNullOrEmpty(item.Menu))
            {  %>onclick="$.prettyPhoto.open(api_gallery1,'<%=item.Name %>',''); return false"
        <%} %> href="javascript:;" rel="prettyPhoto" title="">
        <img class="fl" src="/Content/images/menu_pic.jpg" /></a> <a <%if (!string.IsNullOrEmpty(item.Service))
            { %>onclick="$.prettyPhoto.open(api_gallery2,'<%=item.Name %>',''); return false"
            <%} %> href="javascript:;" rel="prettyPhoto" title="">
            <img class="fl" src="/Content/images/service_pic.jpg" /></a>
    <%
        }
        else if (typeshow == 2)
        { %>
    <a <%if (!string.IsNullOrEmpty(item.Menu))
            {  %>onclick="$.prettyPhoto.open(api_gallery1,'<%=item.Name %>',''); return false"
        <%} %> href="javascript:;" rel="prettyPhoto" title="">
        <img class="fl" src="/Content/images/hinhanh.gif" /></a> <a <%if (!string.IsNullOrEmpty(item.Service))
            { %>onclick="$.prettyPhoto.open(api_gallery2,'<%=item.Name %>',''); return false"
            <%} %> href="javascript:;" rel="prettyPhoto" title="">
            <img class="fl" src="/Content/images/banggia.jpg" /></a>
    <%} %>
    <p class="clear">
    </p>
    <%=item.Content%>
</div>
<p class="m_title">
    Liên hệ</p>
<div class="contact conner4">
    <div class="contact_ct">
        <form method="post" name="Contact">
        <p>
            <label>
                Họ và tên</label><input type="text" name="Name" value="<%=entity.Name %>" /></p>
        <p>
            <label>
                Địa chỉ</label><input type="text" name="Address" value="<%=entity.Address %>" /></p>
        <p>
            <label>
                Điện thoại</label><input type="text" name="Phone" value="<%=entity.Phone %>" /></p>
        <p>
            <label>
                Email</label><input type="text" name="Email" value="<%=entity.Email %>" /></p>
        <p>
            <label>
                Chủ đề</label><input type="text" name="Title" value="<%=entity.Title %>" /></p>
        <p>
            <label>
                Nội dung</label><textarea name="Content"><%=entity.Content %></textarea></p>
        <a class="sent conner4 fr" href="javascript:;" onclick="document.Contact.submit();">
            Gửi</a>
        <input type="submit" name="_hl_action[ContactPOST]" style="display: none" />
        <input type="hidden" name="_hl_action" value="ContactPOST" style="display: none" />
                <input type="hidden" name="EmailSend" value="<%=item.Email %>" />
        </form>
    </div>
    <p class="clear_15">
    </p>
    <div class="add">
    <%=item.Address %>
<%--        {RS:Web_Feedback}--%>
    </div>
</div>
<p class="clear_5">
</p>
             <!--slide & popup-->
		<link rel="stylesheet" href="/Content/popup/css/prettyPhoto.css" type="text/css" media="screen" title="Song Hỷ" charset="utf-8" />
		<script src="/Content/popup/js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>

        <script type="text/javascript" charset="utf-8">
            $(document).ready(function () {
                $("area[rel^='prettyPhoto']").prettyPhoto();

                $(".gallery:first a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'normal', theme: 'light_square', slideshow: 3000, autoplay_slideshow: true });
                $(".gallery:gt(0) a[rel^='prettyPhoto']").prettyPhoto({ animation_speed: 'fast', slideshow: 10000, hideflash: true });

                $("#custom_content a[rel^='prettyPhoto']:first").prettyPhoto({
                    custom_markup: '<div id="map_canvas" style="width:260px; height:265px"></div>',
                    changepicturecallback: function () { initialize(); }
                });

                $("#custom_content a[rel^='prettyPhoto']:last").prettyPhoto({
                    custom_markup: '<div id="bsap_1259344" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div><div id="bsap_1237859" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6" style="height:260px"></div><div id="bsap_1251710" class="bsarocks bsap_d49a0984d0f377271ccbf01a33f2b6d6"></div>',
                    changepicturecallback: function () { _bsap.exec(); }
                });
            });
			</script>
<style type="text/css" media="screen">
    .bsap a
    {
        float: left;
    }
</style>
<script type="text/javascript">
    (function () {
        var bsa = document.createElement('script');
        bsa.type = 'text/javascript';
        bsa.async = true;
        bsa.src = '//s3.buysellads.com/ac/bsa.js';
        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(bsa);
    })();
			</script>
            <!--end popup-->